<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>八字命理 - 性格分析 - 风水住宅</title>
  <link href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css" rel="stylesheet">
  <link href="static/css/main.css" rel="stylesheet">
</head>
<body class="bg-gray-50">
  <!-- 导航栏 -->
  <nav class="bg-white shadow-md">
    <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
      <div class="flex justify-between h-16">
        <div class="flex">
          <div class="flex-shrink-0 flex items-center">
            <h1 class="text-xl font-bold text-indigo-600">八字命理网</h1>
          </div>
          <div class="hidden sm:ml-6 sm:flex sm:space-x-8">
            <a href="#home" class="border-indigo-500 text-gray-900 inline-flex items-center px-1 pt-1 border-b-2 text-sm font-medium">首页</a>
            <a href="#bazi" class="border-transparent text-gray-500 hover:border-gray-300 hover:text-gray-700 inline-flex items-center px-1 pt-1 border-b-2 text-sm font-medium">八字命理</a>
            <a href="#character" class="border-transparent text-gray-500 hover:border-gray-300 hover:text-gray-700 inline-flex items-center px-1 pt-1 border-b-2 text-sm font-medium">性格分析</a>
            <a href="#fengshui" class="border-transparent text-gray-500 hover:border-gray-300 hover:text-gray-700 inline-flex items-center px-1 pt-1 border-b-2 text-sm font-medium">风水住宅</a>
            <a href="#tools" class="border-transparent text-gray-500 hover:border-gray-300 hover:text-gray-700 inline-flex items-center px-1 pt-1 border-b-2 text-sm font-medium">小工具</a>
          </div>
        </div>
        <div class="hidden sm:ml-6 sm:flex sm:items-center">
          <button id="loginBtn" class="btn btn-secondary mr-2">登录</button>
          <button id="registerBtn" class="btn btn-primary">注册</button>
          <button id="userInfoBtn" style="display: none;" class="btn btn-secondary mr-2">个人中心</button>
          <span id="vipBadge" style="display: none;" class="ml-2 inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-yellow-100 text-yellow-800">VIP</span>
          <button id="logoutBtn" style="display: none;" class="btn btn-secondary ml-2">退出</button>
        </div>
      </div>
    </div>
  </nav>

  <!-- 首页内容 -->
  <section id="home" class="py-12">
    <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
      <div class="text-center">
        <h2 class="text-3xl font-extrabold text-gray-900 sm:text-4xl">探索命理奥秘，掌握人生方向</h2>
        <p class="mt-4 text-xl text-gray-500">通过生辰八字分析命运轨迹，了解性格特点，优化居住环境</p>
      </div>

      <div class="mt-12 grid gap-8 grid-cols-1 md:grid-cols-3">
        <div class="bg-white overflow-hidden shadow rounded-lg">
          <div class="px-4 py-5 sm:p-6">
            <div class="flex items-center">
              <div class="flex-shrink-0 bg-indigo-500 rounded-md p-3">
                <svg class="h-6 w-6 text-white" fill="none" viewBox="0 0 24 24" stroke="currentColor">
                  <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-3 7h3m-3 4h3m-6-4h.01M9 16h.01"></path>
                </svg>
              </div>
              <div class="ml-5">
                <h3 class="text-lg font-medium text-gray-900">八字命理</h3>
                <p class="mt-2 text-sm text-gray-500">根据生辰八字，算出命运轨迹，了解人生起伏</p>
              </div>
            </div>
            <div class="mt-4">
              <a href="#bazi" class="inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-indigo-600 hover:bg-indigo-700">
                立即测算
              </a>
            </div>
          </div>
        </div>

        <div class="bg-white overflow-hidden shadow rounded-lg">
          <div class="px-4 py-5 sm:p-6">
            <div class="flex items-center">
              <div class="flex-shrink-0 bg-indigo-500 rounded-md p-3">
                <svg class="h-6 w-6 text-white" fill="none" viewBox="0 0 24 24" stroke="currentColor">
                  <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0zm6 3a2 2 0 11-4 0 2 2 0 014 0zM7 10a2 2 0 11-4 0 2 2 0 014 0z"></path>
                </svg>
              </div>
              <div class="ml-5">
                <h3 class="text-lg font-medium text-gray-900">性格分析</h3>
                <p class="mt-2 text-sm text-gray-500">根据生辰八字分析性格特点，了解今日运势</p>
              </div>
            </div>
            <div class="mt-4">
              <a href="#character" class="inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-indigo-600 hover:bg-indigo-700">
                性格解读
              </a>
            </div>
          </div>
        </div>

        <div class="bg-white overflow-hidden shadow rounded-lg">
          <div class="px-4 py-5 sm:p-6">
            <div class="flex items-center">
              <div class="flex-shrink-0 bg-indigo-500 rounded-md p-3">
                <svg class="h-6 w-6 text-white" fill="none" viewBox="0 0 24 24" stroke="currentColor">
                  <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-6 0a1 1 0 001-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 001 1m-6 0h6"></path>
                </svg>
              </div>
              <div class="ml-5">
                <h3 class="text-lg font-medium text-gray-900">风水住宅</h3>
                <p class="mt-2 text-sm text-gray-500">分析房屋结构，提供风水改善建议</p>
              </div>
            </div>
            <div class="mt-4">
              <a href="#fengshui" class="inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-indigo-600 hover:bg-indigo-700">
                风水分析
              </a>
            </div>
          </div>
        </div>
      </div>

      <div class="mt-12 bg-white overflow-hidden shadow rounded-lg">
        <div class="px-4 py-5 sm:p-6">
          <h3 class="text-lg font-medium text-gray-900">会员权益</h3>
          <div class="mt-4 grid gap-4 grid-cols-1 md:grid-cols-3">
            <div class="border rounded-md p-4">
              <h4 class="font-medium">免费用户</h4>
              <ul class="mt-2 text-sm text-gray-500 space-y-1">
                <li>• 基础八字分析</li>
                <li>• 基础性格分析</li>
                <li>• 基础风水分析</li>
                <li>• 小工具使用</li>
              </ul>
            </div>
            <div class="border rounded-md p-4">
              <h4 class="font-medium">单次付费</h4>
              <ul class="mt-2 text-sm text-gray-500 space-y-1">
                <li>• 未登录：1.1元/次</li>
                <li>• 已登录：0.1元/次</li>
                <li>• 详细命理解析</li>
                <li>• 详细风水建议</li>
              </ul>
            </div>
            <div class="border border-indigo-200 bg-indigo-50 rounded-md p-4">
              <h4 class="font-medium text-indigo-700">VIP会员 (9.9元)</h4>
              <ul class="mt-2 text-sm text-gray-600 space-y-1">
                <li>• 无限次使用所有功能</li>
                <li>• 详细命理解析</li>
                <li>• 详细性格分析</li>
                <li>• 专业风水改善方案</li>
                <li>• 优先客服支持</li>
              </ul>
              <button id="becomeVipBtn" class="mt-3 inline-flex items-center px-3 py-1.5 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-indigo-600 hover:bg-indigo-700">
                立即开通
              </button>
            </div>
          </div>
        </div>
      </div>
    </div>
  </section>

  <!-- 八字命理 -->
  <section id="bazi" class="py-12 bg-gray-100">
    <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
      <div class="text-center">
        <h2 class="text-3xl font-extrabold text-gray-900">八字命理分析</h2>
        <p class="mt-4 text-xl text-gray-500">根据您的生辰八字，分析命运轨迹</p>
      </div>

      <div class="mt-12 bg-white overflow-hidden shadow rounded-lg">
        <div class="px-4 py-5 sm:p-6">
          <form id="baziForm" class="space-y-6">
            <div class="grid grid-cols-1 gap-6 sm:grid-cols-2">
              <div class="form-group">
                <label for="birthYear" class="form-label">出生年份</label>
                <select id="birthYear" class="form-select">
                  <option value="">请选择</option>
                  <!-- 动态生成1940-2025年 -->
                  <script>
                    for (let i = 1940; i <= 2025; i++) {
                      document.write(`<option value="${i}">${i}年</option>`);
                    }
                  </script>
                </select>
              </div>
              <div class="form-group">
                <label for="birthMonth" class="form-label">出生月份</label>
                <select id="birthMonth" class="form-select">
                  <option value="">请选择</option>
                  <option value="1">1月</option>
                  <option value="2">2月</option>
                  <option value="3">3月</option>
                  <option value="4">4月</option>
                  <option value="5">5月</option>
                  <option value="6">6月</option>
                  <option value="7">7月</option>
                  <option value="8">8月</option>
                  <option value="9">9月</option>
                  <option value="10">10月</option>
                  <option value="11">11月</option>
                  <option value="12">12月</option>
                </select>
              </div>
              <div class="form-group">
                <label for="birthDay" class="form-label">出生日期</label>
                <select id="birthDay" class="form-select">
                  <option value="">请选择</option>
                  <!-- 动态生成1-31日 -->
                  <script>
                    for (let i = 1; i <= 31; i++) {
                      document.write(`<option value="${i}">${i}日</option>`);
                    }
                  </script>
                </select>
              </div>
              <div class="form-group">
                <label for="birthHour" class="form-label">出生时辰</label>
                <select id="birthHour" class="form-select">
                  <option value="">请选择</option>
                  <option value="0">子时 (23:00-01:00)</option>
                  <option value="1">丑时 (01:00-03:00)</option>
                  <option value="2">寅时 (03:00-05:00)</option>
                  <option value="3">卯时 (05:00-07:00)</option>
                  <option value="4">辰时 (07:00-09:00)</option>
                  <option value="5">巳时 (09:00-11:00)</option>
                  <option value="6">午时 (11:00-13:00)</option>
                  <option value="7">未时 (13:00-15:00)</option>
                  <option value="8">申时 (15:00-17:00)</option>
                  <option value="9">酉时 (17:00-19:00)</option>
                  <option value="10">戌时 (19:00-21:00)</option>
                  <option value="11">亥时 (21:00-23:00)</option>
                </select>
              </div>
            </div>
            <div class="flex justify-center">
              <button type="submit" class="btn btn-primary">
                生成八字
              </button>
            </div>
          </form>

          <!-- 隐藏字段，用于存储八字ID -->
          <input type="hidden" id="baziId" value="">

          <!-- 八字分析结果 -->
          <div id="baziResultContainer" class="result-container">
            <h3 class="text-xl font-bold mb-4">八字分析结果</h3>
            <div id="baziInfo" class="mb-4"></div>
            <div id="baziAnalysis"></div>
            <div class="mt-6 flex justify-center">
              <button id="viewBaziDetailBtn" class="btn btn-primary">
                查看详细分析
              </button>
            </div>
          </div>

          <!-- 八字详细分析结果 -->
          <div id="baziDetailContainer" class="result-container">
            <div id="baziDetailContent"></div>
          </div>
        </div>
      </div>
    </div>
  </section>

  <!-- 性格分析 -->
  <section id="character" class="py-12">
    <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
      <div class="text-center">
        <h2 class="text-3xl font-extrabold text-gray-900">性格分析</h2>
        <p class="mt-4 text-xl text-gray-500">了解您的性格特点，把握今日运势</p>
      </div>

      <div class="mt-12 bg-white overflow-hidden shadow rounded-lg">
        <div class="px-4 py-5 sm:p-6">
          <form id="characterForm" class="space-y-6">
            <div class="text-center">
              <p class="text-gray-500 mb-4">请先在八字命理页面生成您的八字</p>
              <!-- 隐藏字段，用于存储八字ID -->
              <input type="hidden" id="characterBaziId" value="">
              <button type="submit" class="btn btn-primary">
                分析性格
              </button>
            </div>
          </form>

          <!-- 性格分析结果 -->
          <div id="characterResultContainer" class="result-container">
            <h3 class="text-xl font-bold mb-4">性格分析结果</h3>
            <div id="characterInfo" class="mb-4"></div>
            <div id="characterAnalysis"></div>
            <div class="mt-6 flex justify-center space-x-4">
              <button id="viewCharacterDetailBtn" class="btn btn-primary">
                查看详细分析
              </button>
              <button id="getDailyFortuneBtn" class="btn btn-secondary">
                查看今日运势
              </button>
            </div>
          </div>

          <!-- 性格详细分析结果 -->
          <div id="characterDetailContainer" class="result-container">
            <div id="characterDetailContent"></div>
          </div>

          <!-- 今日运势 -->
          <div id="dailyFortuneContainer" class="result-container">
            <div id="dailyFortuneContent"></div>
          </div>
        </div>
      </div>
    </div>
  </section>

  <!-- 风水住宅 -->
  <section id="fengshui" class="py-12 bg-gray-100">
    <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
      <div class="text-center">
        <h2 class="text-3xl font-extrabold text-gray-900">风水住宅分析</h2>
        <p class="mt-4 text-xl text-gray-500">分析房屋结构，提供风水改善建议</p>
      </div>

      <div class="mt-12 bg-white overflow-hidden shadow rounded-lg">
        <div class="px-4 py-5 sm:p-6">
          <form id="fengshuiForm" class="space-y-6">
            <div class="grid grid-cols-1 gap-6 sm:grid-cols-2">
              <div class="form-group">
                <label for="houseType" class="form-label">房屋类型</label>
                <select id="houseType" class="form-select">
                  <option value="">请选择</option>
                  <option value="apartment">公寓</option>
                  <option value="house">独栋住宅</option>
                  <option value="villa">别墅</option>
                  <option value="townhouse">联排别墅</option>
                  <option value="office">办公室</option>
                  <option value="shop">商铺</option>
                </select>
              </div>
              <div class="form-group">
                <label for="houseDirection" class="form-label">房屋朝向</label>
                <select id="houseDirection" class="form-select">
                  <option value="">请选择</option>
                  <option value="north">北</option>
                  <option value="northeast">东北</option>
                  <option value="east">东</option>
                  <option value="southeast">东南</option>
                  <option value="south">南</option>
                  <option value="southwest">西南</option>
                  <option value="west">西</option>
                  <option value="northwest">西北</option>
                </select>
              </div>
            </div>
            <div class="form-group">
              <label for="houseLayout" class="form-label">房屋布局</label>
              <textarea id="houseLayout" class="form-textarea" placeholder="请描述房屋的整体布局，包括房间数量、位置等"></textarea>
            </div>
            <div class="form-group">
              <label for="houseConcerns" class="form-label">关注问题</label>
              <textarea id="houseConcerns" class="form-textarea" placeholder="请描述您关注的风水问题或希望改善的方面"></textarea>
            </div>
            <div class="flex justify-center">
              <button type="submit" class="btn btn-primary">
                分析风水
              </button>
            </div>
          </form>

          <!-- 隐藏字段，用于存储风水ID -->
          <input type="hidden" id="fengshuiId" value="">

          <!-- 风水分析结果 -->
          <div id="fengshuiResultContainer" class="result-container">
            <h3 class="text-xl font-bold mb-4">风水分析结果</h3>
            <div id="fengshuiInfo" class="mb-4"></div>
            <div id="fengshuiAnalysis"></div>
            <div class="mt-6 flex justify-center">
              <button id="viewFengshuiDetailBtn" class="btn btn-primary">
                查看详细分析
              </button>
            </div>
          </div>

          <!-- 风水详细分析结果 -->
          <div id="fengshuiDetailContainer" class="result-container">
            <div id="fengshuiDetailContent"></div>
          </div>
        </div>
      </div>
    </div>
  </section>

  <!-- 小工具 -->
  <section id="tools" class="py-12">
    <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
      <div class="text-center">
        <h2 class="text-3xl font-extrabold text-gray-900">实用小工具</h2>
        <p class="mt-4 text-xl text-gray-500">万年历、星座与生肖查询等实用工具</p>
      </div>

      <div class="mt-12 grid gap-8 grid-cols-1 md:grid-cols-2">
        <!-- 万年历 -->
        <div class="bg-white overflow-hidden shadow rounded-lg">
          <div class="px-4 py-5 sm:p-6">
            <h3 class="text-lg font-medium text-gray-900 mb-4">万年历</h3>
            <form id="calendarForm" class="space-y-4">
              <div class="grid grid-cols-2 gap-4">
                <div class="form-group">
                  <label for="calendarYear" class="form-label">年份</label>
                  <select id="calendarYear" class="form-select">
                    <option value="">请选择</option>
                    <!-- 动态生成2020-2030年 -->
                    <script>
                      for (let i = 2020; i <= 2030; i++) {
                        document.write(`<option value="${i}">${i}年</option>`);
                      }
                    </script>
                  </select>
                </div>
                <div class="form-group">
                  <label for="calendarMonth" class="form-label">月份</label>
                  <select id="calendarMonth" class="form-select">
                    <option value="">请选择</option>
                    <option value="1">1月</option>
                    <option value="2">2月</option>
                    <option value="3">3月</option>
                    <option value="4">4月</option>
                    <option value="5">5月</option>
                    <option value="6">6月</option>
                    <option value="7">7月</option>
                    <option value="8">8月</option>
                    <option value="9">9月</option>
                    <option value="10">10月</option>
                    <option value="11">11月</option>
                    <option value="12">12月</option>
                  </select>
                </div>
              </div>
              <div class="flex justify-center">
                <button type="submit" class="btn btn-primary">
                  查询
                </button>
              </div>
            </form>

            <!-- 万年历结果 -->
            <div id="calendarResultContainer" class="result-container">
              <div id="calendarContent"></div>
            </div>
          </div>
        </div>

        <!-- 星座与生肖 -->
        <div class="bg-white overflow-hidden shadow rounded-lg">
          <div class="px-4 py-5 sm:p-6">
            <h3 class="text-lg font-medium text-gray-900 mb-4">星座与生肖</h3>
            <div class="space-y-6">
              <!-- 星座查询 -->
              <div>
                <h4 class="font-medium text-gray-700 mb-2">星座查询</h4>
                <form id="zodiacSignForm" class="space-y-4">
                  <div class="grid grid-cols-2 gap-4">
                    <div class="form-group">
                      <label for="zodiacMonth" class="form-label">月份</label>
                      <select id="zodiacMonth" class="form-select">
                        <option value="">请选择</option>
                        <option value="1">1月</option>
                        <option value="2">2月</option>
                        <option value="3">3月</option>
                        <option value="4">4月</option>
                        <option value="5">5月</option>
                        <option value="6">6月</option>
                        <option value="7">7月</option>
                        <option value="8">8月</option>
                        <option value="9">9月</option>
                        <option value="10">10月</option>
                        <option value="11">11月</option>
                        <option value="12">12月</option>
                      </select>
                    </div>
                    <div class="form-group">
                      <label for="zodiacDay" class="form-label">日期</label>
                      <select id="zodiacDay" class="form-select">
                        <option value="">请选择</option>
                        <!-- 动态生成1-31日 -->
                        <script>
                          for (let i = 1; i <= 31; i++) {
                            document.write(`<option value="${i}">${i}日</option>`);
                          }
                        </script>
                      </select>
                    </div>
                  </div>
                  <div class="flex justify-center">
                    <button type="submit" class="btn btn-primary">
                      查询星座
                    </button>
                  </div>
                </form>

                <!-- 星座结果 -->
                <div id="zodiacSignResultContainer" class="result-container">
                  <div id="zodiacSignContent"></div>
                </div>
              </div>

              <!-- 生肖查询 -->
              <div>
                <h4 class="font-medium text-gray-700 mb-2">生肖查询</h4>
                <form id="chineseZodiacForm" class="space-y-4">
                  <div class="form-group">
                    <label for="zodiacYear" class="form-label">出生年份</label>
                    <select id="zodiacYear" class="form-select">
                      <option value="">请选择</option>
                      <!-- 动态生成1940-2025年 -->
                      <script>
                        for (let i = 1940; i <= 2025; i++) {
                          document.write(`<option value="${i}">${i}年</option>`);
                        }
                      </script>
                    </select>
                  </div>
                  <div class="flex justify-center">
                    <button type="submit" class="btn btn-primary">
                      查询生肖
                    </button>
                  </div>
                </form>

                <!-- 生肖结果 -->
                <div id="chineseZodiacResultContainer" class="result-container">
                  <div id="chineseZodiacContent"></div>
                </div>
              </div>
            </div>
          </div>
        </div>

        <!-- 姓名测算 -->
        <div class="bg-white overflow-hidden shadow rounded-lg">
          <div class="px-4 py-5 sm:p-6">
            <h3 class="text-lg font-medium text-gray-900 mb-4">姓名测算</h3>
            <form id="nameAnalysisForm" class="space-y-4">
              <div class="form-group">
                <label for="nameInput" class="form-label">姓名</label>
                <input type="text" id="nameInput" class="form-input" placeholder="请输入您的姓名">
              </div>
              <div class="flex justify-center">
                <button type="submit" class="btn btn-primary">
                  测算姓名
                </button>
              </div>
            </form>

            <!-- 姓名测算结果 -->
            <div id="nameAnalysisResultContainer" class="result-container">
              <div id="nameAnalysisContent"></div>
            </div>
          </div>
        </div>

        <!-- 周公解梦 -->
        <div class="bg-white overflow-hidden shadow rounded-lg">
          <div class="px-4 py-5 sm:p-6">
            <h3 class="text-lg font-medium text-gray-900 mb-4">周公解梦</h3>
            <form id="dreamForm" class="space-y-4">
              <div class="form-group">
                <label for="dreamKeyword" class="form-label">梦境关键词</label>
                <input type="text" id="dreamKeyword" class="form-input" placeholder="请输入梦境关键词，如：蛇、飞、考试等">
              </div>
              <div class="flex justify-center">
                <button type="submit" class="btn btn-primary">
                  解梦
                </button>
              </div>
            </form>

            <!-- 解梦结果 -->
            <div id="dreamResultContainer" class="result-container">
              <div id="dreamContent"></div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </section>

  <!-- 页脚 -->
  <footer class="bg-gray-800 text-white py-8">
    <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
      <div class="grid grid-cols-1 md:grid-cols-3 gap-8">
        <div>
          <h3 class="text-lg font-medium">八字命理网</h3>
          <p class="mt-2 text-gray-400">探索命理奥秘，掌握人生方向</p>
        </div>
        <div>
          <h3 class="text-lg font-medium">联系我们</h3>
          <p class="mt-2 text-gray-400">客服邮箱：support@baziapp.com</p>
          <p class="text-gray-400">客服电话：400-123-4567</p>
        </div>
        <div>
          <h3 class="text-lg font-medium">关注我们</h3>
          <div class="mt-2 flex space-x-4">
            <a href="#" class="text-gray-400 hover:text-white">
              <span>微信公众号</span>
            </a>
            <a href="#" class="text-gray-400 hover:text-white">
              <span>微博</span>
            </a>
            <a href="#" class="text-gray-400 hover:text-white">
              <span>抖音</span>
            </a>
          </div>
        </div>
      </div>
      <div class="mt-8 border-t border-gray-700 pt-8 text-center">
        <p class="text-gray-400">© 2025 八字命理网 版权所有</p>
      </div>
    </div>
  </footer>

  <!-- 登录模态框 -->
  <div id="loginModal" class="modal">
    <div class="modal-content">
      <span class="close-button" onclick="closeModal('loginModal')">&times;</span>
      <h3 class="text-xl font-bold mb-4">用户登录</h3>
      <form id="loginForm" class="space-y-4">
        <div class="form-group">
          <label for="loginPhone" class="form-label">手机号</label>
          <input type="text" id="loginPhone" class="form-input" placeholder="请输入手机号">
        </div>
        <div class="form-group">
          <label for="loginPassword" class="form-label">密码</label>
          <input type="password" id="loginPassword" class="form-input" placeholder="请输入密码">
        </div>
        <div class="flex justify-between items-center">
          <button type="submit" class="btn btn-primary">
            登录
          </button>
          <button type="button" class="text-indigo-600 hover:text-indigo-500" onclick="closeModal('loginModal');document.getElementById('registerModal').style.display='block';">
            没有账号？去注册
          </button>
        </div>
      </form>
    </div>
  </div>

  <!-- 注册模态框 -->
  <div id="registerModal" class="modal">
    <div class="modal-content">
      <span class="close-button" onclick="closeModal('registerModal')">&times;</span>
      <h3 class="text-xl font-bold mb-4">用户注册</h3>
      <form id="registerForm" class="space-y-4">
        <div class="form-group">
          <label for="registerPhone" class="form-label">手机号</label>
          <input type="text" id="registerPhone" class="form-input" placeholder="请输入手机号">
        </div>
        <div class="form-group">
          <label for="registerVerifyCode" class="form-label">验证码</label>
          <div class="flex space-x-2">
            <input type="text" id="registerVerifyCode" class="form-input flex-1" placeholder="请输入验证码">
            <button type="button" class="btn btn-secondary">
              获取验证码
            </button>
          </div>
        </div>
        <div class="form-group">
          <label for="registerPassword" class="form-label">密码</label>
          <input type="password" id="registerPassword" class="form-input" placeholder="请设置密码">
        </div>
        <div class="form-group">
          <label for="registerNickname" class="form-label">昵称</label>
          <input type="text" id="registerNickname" class="form-input" placeholder="请设置昵称">
        </div>
        <div class="flex justify-between items-center">
          <button type="submit" class="btn btn-primary">
            注册
          </button>
          <button type="button" class="text-indigo-600 hover:text-indigo-500" onclick="closeModal('registerModal');document.getElementById('loginModal').style.display='block';">
            已有账号？去登录
          </button>
        </div>
      </form>
    </div>
  </div>

  <!-- 支付模态框 -->
  <div id="paymentModal" class="modal">
    <div class="modal-content">
      <span class="close-button" onclick="closeModal('paymentModal')">&times;</span>
      <h3 id="paymentTitle" class="text-xl font-bold mb-4">内容付费</h3>
      <div class="text-center mb-6">
        <p class="text-gray-500">查看详细内容需要支付</p>
        <p class="text-2xl font-bold text-indigo-600 mt-2" id="paymentAmount">¥1.1</p>
      </div>
      <form id="paymentForm" class="space-y-4">
        <input type="hidden" id="paymentType" value="">
        <input type="hidden" id="productId" value="">
        <div class="form-group">
          <label class="form-label">支付方式</label>
          <div class="grid grid-cols-2 gap-4 mt-2">
            <div class="border rounded-md p-3 flex items-center space-x-3 cursor-pointer bg-indigo-50 border-indigo-500">
              <input type="radio" name="paymentMethod" value="alipay" checked>
              <span>支付宝</span>
            </div>
            <div class="border rounded-md p-3 flex items-center space-x-3 cursor-pointer">
              <input type="radio" name="paymentMethod" value="wechat">
              <span>微信支付</span>
            </div>
          </div>
        </div>
        <div class="flex justify-center">
          <button type="submit" class="btn btn-primary">
            确认支付
          </button>
        </div>
      </form>
    </div>
  </div>

  <!-- 脚本引入 -->
  <script src="static/js/api.js"></script>
  <script src="static/js/auth.js"></script>
  <script src="static/js/bazi.js"></script>
  <script src="static/js/character.js"></script>
  <script src="static/js/fengshui.js"></script>
  <script src="static/js/tools.js"></script>
  <script src="static/js/payment.js"></script>

  <script>
    // 页面初始化
    document.addEventListener('DOMContentLoaded', function() {
      // 登录按钮点击事件
      const loginBtn = document.getElementById('loginBtn');
      if (loginBtn) {
        loginBtn.addEventListener('click', function() {
          document.getElementById('loginModal').style.display = 'block';
        });
      }
      
      // 注册按钮点击事件
      const registerBtn = document.getElementById('registerBtn');
      if (registerBtn) {
        registerBtn.addEventListener('click', function() {
          document.getElementById('registerModal').style.display = 'block';
        });
      }
      
      // 开通VIP按钮点击事件
      const becomeVipBtn = document.getElementById('becomeVipBtn');
      if (becomeVipBtn) {
        becomeVipBtn.addEventListener('click', function() {
          if (checkNeedLogin()) return;
          
          // 检查是否已是VIP
          if (currentUser && currentUser.isVip) {
            showToast('您已经是VIP会员');
            return;
          }
          
          // 设置支付相关信息
          document.getElementById('paymentType').value = 'vip';
          document.getElementById('productId').value = '';
          document.getElementById('paymentTitle').textContent = '开通VIP会员';
          document.getElementById('paymentAmount').textContent = '¥9.9';
          document.getElementById('paymentModal').style.display = 'block';
        });
      }
      
      // 模拟数据
      // 为了演示效果，这里使用模拟数据
      window.mockData = {
        bazi: {
          baziId: '123456',
          bazi: '甲子 乙丑 丙寅 丁卯',
          dayMaster: '丙',
          fiveElements: '木水火木',
          nayin: '海中金',
          basicAnalysis: '您的八字日主为丙火，五行木水火木，八字中木旺，火相对不足。日主丙火坐下寅木，为火生于木，根基较好。整体八字显示您性格开朗，富有创造力，但有时缺乏耐心。',
          personality: '性格开朗活泼，热情洋溢，富有创造力和领导才能。做事积极主动，但有时缺乏耐心，容易冲动。',
          career: '适合从事需要创造力和表现力的工作，如市场营销、销售、教育、艺术等领域。事业发展较为顺利，中年后有较大发展。',
          wealth: '财运中上，有较好的赚钱能力，但需注意理财和投资风险。40岁后财运明显好转，有意外之财。',
          health: '体质偏热，易有心火旺盛、高血压等问题。应注意情绪调节，避免过度劳累和熬夜。',
          relationships: '人缘较好，社交能力强，异性缘佳。婚姻感情有波折，需要双方互相理解和包容。',
          directions: '东南方向为吉，有利于事业发展和财运；西北方向为凶，应尽量避免。',
          fortune: '近期运势平稳，工作有新的机遇，但需谨慎决策。2025年是重要转折点，有利于事业发展。',
          suggestions: '建议多接触水属性事物，如靠近水源居住或办公，佩戴蓝色或黑色饰品。避免过度劳累，保持良好的作息习惯。在事业上可以尝试创新，但需做好风险评估。'
        },
        character: {
          characterType: '阳刚开朗型',
          fiveElements: '木旺火相',
          yinYang: '阳性',
          basicAnalysis: '您属于阳刚开朗型性格，五行木旺火相，阳性特质明显。性格开朗活泼，热情洋溢，富有创造力和领导才能。社交能力强，善于表达，但有时过于直率。',
          traits: '性格开朗活泼，热情洋溢，富有创造力和领导才能。做事积极主动，但有时缺乏耐心，容易冲动。处事果断，有决断力，但有时过于武断。',
          thinkingStyle: '思维活跃，创意丰富，善于发散思考，但有时缺乏系统性和条理性。对新事物接受能力强，学习能力好，但需加强专注力和深度思考。',
          emotionalExpression: '情感表达直接，不善掩饰，喜怒形于色。情绪波动较大，容易激动，但也容易平复。感情丰富，重情义，对亲友慷慨大方。',
          socialInteraction: '社交能力强，人缘好，善于沟通和表达。在团体中常常成为领导者或意见领袖。乐于助人，热心公益，但有时过于相信他人。',
          workStyle: '工作积极主动，有创新精神，不拘泥于常规。做事雷厉风行，效率高，但有时欠缺耐心和细致。领导能力强，善于激励团队，但管理细节有待加强。',
          suitableCareers: '适合从事需要创造力和表现力的工作，如市场营销、销售、教育、艺术、媒体、公关等领域。也适合创业或担任管理职位。',
          challenges: '需要克服的挑战包括：情绪控制、耐心培养、细节关注、倾听能力提升、风险评估能力加强等。',
          growthSuggestions: '建议加强自我情绪管理，培养耐心和细致的工作态度。学习倾听他人意见，提高团队协作能力。在决策前做好充分的调研和风险评估。培养一项需要专注和耐心的兴趣爱好，如书法、园艺等。'
        },
        dailyFortune: {
          date: '2025年5月18日',
          overallRating: 4,
          overallDesc: '今日整体运势不错，适合社交活动和创意工作，财运和感情运势都较为顺利。',
          careerRating: 3,
          careerDesc: '工作中可能有新的机会，但需要谨慎决策，不要急于求成。下午有利于团队合作和创意讨论。',
          wealthRating: 4,
          wealthDesc: '财运不错，适合投资和理财规划，但大额支出需谨慎。可能有意外收入或回报。',
          loveRating: 5,
          loveDesc: '感情运势极佳，单身者有机会遇到心仪对象，已有伴侣的感情更加甜蜜。适合表白或约会。',
          healthTips: '注意饮食规律，避免过度劳累和熬夜。适当运动有助于缓解压力，建议进行有氧运动。',
          luckyColor: '蓝色、绿色',
          luckyDirection: '东南方'
        },
        fengshui: {
          fengshuiId: '789012',
          houseType: '公寓',
          houseDirection: '南',
          overallScore: 78,
          basicAnalysis: '您的住宅整体风水状况良好，南向朝阳，采光充足，有利于阳气的聚集。房屋格局基本合理，但存在一些可以改善的地方。',
          layoutAnalysis: '整体格局方正，动静分区合理，但客厅与厨房的位置关系需要调整。客厅位于住宅中心位置，有利于家人聚集和能量流通。',
          directionAnalysis: '南向朝阳，采光充足，有利于阳气的聚集和家人健康。主要活动区域能够获得充足的自然光，有利于提升居住者的精神状态和健康水平。',
          livingRoomAnalysis: '客厅宽敞明亮，布局合理，但沙发位置背对门窗，不利于安全感和稳定感的建立。建议调整沙发位置，使其背靠实墙，面向入口。',
          bedroomAnalysis: '主卧室位置良好，但床位靠近窗户，容易导致睡眠质量下降。建议将床移至实墙一侧，并确保床头有靠山。次卧采光不足，需要改善照明条件。',
          kitchenAnalysis: '厨房位于住宅西南方，与火相克，不太理想。炉灶位置正对卫生间，水火相克，不利于家人健康和财运。建议在炉灶和卫生间之间设置屏风或植物进行化解。',
          bathroomAnalysis: '卫生间位置基本合理，但与厨房相邻，水火相克。卫生间门直对卧室门，不利于健康和隐私。建议在卫生间门外设置屏风或植物进行遮挡。',
          wealthPositionAnalysis: '财位位于住宅东南方，目前被杂物占据，不利于财运。建议清理财位上的杂物，放置招财植物如金钱树、富贵竹等，或者放置水晶、聚宝盆等物品。',
          improvementSuggestions: [
            {
              title: '调整沙发位置',
              description: '将客厅沙发调整为背靠实墙，面向入口，增强安全感和稳定感。'
            },
            {
              title: '改善床位布局',
              description: '将主卧床位移至实墙一侧，确保床头有靠山，避免床位正对门窗或镜子。'
            },
            {
              title: '化解厨卫相冲',
              description: '在厨房炉灶和卫生间之间设置屏风或放置绿色植物，化解水火相克。'
            },
            {
              title: '布置财位',
              description: '清理东南方财位上的杂物，放置招财植物或水晶、聚宝盆等物品。'
            },
            {
              title: '增加绿植',
              description: '在住宅内适当增加绿色植物，如富贵竹、发财树等，改善空气质量和能量流动。'
            },
            {
              title: '调整照明',
              description: '增加次卧的照明设备，确保光线充足但不刺眼。'
            }
          ]
        },
        calendar: {
          year: 2025,
          month: 5,
          daysInMonth: 31,
          firstDayOfWeek: 4, // 0表示周日，4表示周四
          days: [
            {
              day: 1,
              lunarDay: '三月廿四',
              isToday: false
            },
            {
              day: 2,
              lunarDay: '三月廿五',
              isToday: false
            },
            // ... 其他日期
            {
              day: 18,
              lunarDay: '四月十一',
              isToday: true
            }
            // ... 其他日期
          ]
        },
        zodiacSign: {
          name: '金牛座',
          date: '4月20日-5月20日',
          image: 'https://example.com/taurus.png',
          personality: '金牛座的人稳重踏实，有耐心，重视安全感和物质享受。做事认真负责，有极强的坚持力，但有时过于固执。',
          strengths: '耐心、可靠、实际、稳定、忠诚',
          weaknesses: '固执、占有欲强、不易改变',
          loveView: '在感情中注重稳定和安全感，对伴侣忠诚专一，但有时过于占有。喜欢通过物质表达爱意，重视感官享受。',
          career: '适合需要耐心和细致的工作，如金融、会计、农业、艺术、音乐等领域。工作态度认真负责，值得信赖。',
          luckyColor: '绿色、粉色',
          luckyNumber: '2, 6, 9'
        },
        chineseZodiac: {
          name: '虎',
          years: '1926, 1938, 1950, 1962, 1974, 1986, 1998, 2010, 2022',
          image: 'https://example.com/tiger.png',
          personality: '属虎的人勇敢自信，有领导才能，性格独立，富有正义感。做事雷厉风行，敢于冒险，但有时过于冲动。',
          fiveElements: '寅木',
          mascot: '貔貅',
          luckyNumbers: '1, 3, 4',
          luckyColors: '蓝色、灰色、橙色',
          bestMatch: '属马、属狗、属猪'
        },
        nameAnalysis: {
          name: '张三',
          fiveElements: '木水',
          score: 85,
          evaluation: '您的姓名五行属木水，木水相生，有助于事业发展和财运。姓名整体能量较为平衡，有利于人际关系和健康。',
          personality: '性格温和稳重，做事认真负责，有较强的适应能力和学习能力。善于沟通，人际关系良好。',
          career: '适合从事与水木相关的行业，如教育、文化、艺术、医疗、环保等领域。事业发展较为顺利，中年后有较大成就。',
          wealth: '财运中上，有较好的理财能力，但需避免冲动消费和高风险投资。40岁后财运明显好转。',
          health: '体质中等，易有肝胆、消化系统问题。应注意饮食规律，保持良好的作息习惯。',
          relationships: '人缘较好，社交能力强，家庭关系和谐。婚姻感情较为稳定，但需要双方互相理解和包容。'
        },
        dream: {
          keyword: '蛇',
          interpretation: '梦见蛇通常象征着潜意识中的智慧、转变和再生。在中国传统文化中，蛇还与财富和健康有关。梦见蛇可能意味着您正在经历或即将经历一段转变期，或者暗示您需要关注自己的健康状况。',
          luckyIndex: 3,
          tips: '如果梦中的蛇是友好的或给您带来好处，通常预示着好运和积极的变化。如果梦中的蛇具有威胁性，可能暗示您生活中存在隐藏的危险或压力，建议保持警惕并寻找解决方法。'
        }
      };
      
      // 模拟API请求
      // 为了演示效果，重写API方法，使用模拟数据
      baziAPI.generateBazi = function(token, birthYear, birthMonth, birthDay, birthHour) {
        return new Promise((resolve) => {
          setTimeout(() => {
            resolve({
              code: 200,
              message: '生成成功',
              data: window.mockData.bazi
            });
          }, 1000);
        });
      };
      
      baziAPI.getBaziDetail = function(token, baziId) {
        return new Promise((resolve) => {
          setTimeout(() => {
            resolve({
              code: 200,
              message: '获取成功',
              data: window.mockData.bazi
            });
          }, 1000);
        });
      };
      
      characterAPI.getCharacterAnalysis = function(token, baziId) {
        return new Promise((resolve) => {
          setTimeout(() => {
            resolve({
              code: 200,
              message: '获取成功',
              data: window.mockData.character
            });
          }, 1000);
        });
      };
      
      characterAPI.getCharacterDetail = function(token, baziId) {
        return new Promise((resolve) => {
          setTimeout(() => {
            resolve({
              code: 200,
              message: '获取成功',
              data: window.mockData.character
            });
          }, 1000);
        });
      };
      
      characterAPI.getDailyFortune = function(token) {
        return new Promise((resolve) => {
          setTimeout(() => {
            resolve({
              code: 200,
              message: '获取成功',
              data: window.mockData.dailyFortune
            });
          }, 1000);
        });
      };
      
      fengshuiAPI.submitFengshuiAnalysis = function(token, data) {
        return new Promise((resolve) => {
          setTimeout(() => {
            resolve({
              code: 200,
              message: '提交成功',
              data: window.mockData.fengshui
            });
          }, 1000);
        });
      };
      
      fengshuiAPI.getFengshuiDetail = function(token, fengshuiId) {
        return new Promise((resolve) => {
          setTimeout(() => {
            resolve({
              code: 200,
              message: '获取成功',
              data: window.mockData.fengshui
            });
          }, 1000);
        });
      };
      
      toolAPI.getCalendar = function(year, month) {
        return new Promise((resolve) => {
          setTimeout(() => {
            resolve({
              code: 200,
              message: '获取成功',
              data: window.mockData.calendar
            });
          }, 1000);
        });
      };
      
      toolAPI.getZodiacSign = function(month, day) {
        return new Promise((resolve) => {
          setTimeout(() => {
            resolve({
              code: 200,
              message: '获取成功',
              data: window.mockData.zodiacSign
            });
          }, 1000);
        });
      };
      
      toolAPI.getChineseZodiac = function(year) {
        return new Promise((resolve) => {
          setTimeout(() => {
            resolve({
              code: 200,
              message: '获取成功',
              data: window.mockData.chineseZodiac
            });
          }, 1000);
        });
      };
      
      toolAPI.nameAnalysis = function(name) {
        return new Promise((resolve) => {
          setTimeout(() => {
            const data = {...window.mockData.nameAnalysis};
            data.name = name;
            resolve({
              code: 200,
              message: '获取成功',
              data: data
            });
          }, 1000);
        });
      };
      
      toolAPI.dreamInterpretation = function(keyword) {
        return new Promise((resolve) => {
          setTimeout(() => {
            const data = {...window.mockData.dream};
            data.keyword = keyword;
            resolve({
              code: 200,
              message: '获取成功',
              data: data
            });
          }, 1000);
        });
      };
      
      // 模拟用户登录
      authAPI.login = function(phone, password) {
        return new Promise((resolve) => {
          setTimeout(() => {
            resolve({
              code: 200,
              message: '登录成功',
              data: {
                userId: 1,
                token: 'mock_token_123456'
              }
            });
          }, 1000);
        });
      };
      
      authAPI.getUserInfo = function(token) {
        return new Promise((resolve) => {
          setTimeout(() => {
            resolve({
              code: 200,
              message: '获取成功',
              data: {
                userId: 1,
                phone: '13800138000',
                nickname: '测试用户',
                avatar: '',
                gender: 1,
                birthYear: 1990,
                birthMonth: 5,
                birthDay: 15,
                birthHour: 6,
                registerTime: '2025-01-01 12:00:00',
                lastLoginTime: '2025-05-18 08:00:00',
                isVip: false,
                vipExpireTime: null,
                balance: 10.00
              }
            });
          }, 1000);
        });
      };
      
      // 模拟支付
      paymentAPI.createOrder = function(token, productType, productId, amount) {
        return new Promise((resolve) => {
          setTimeout(() => {
            resolve({
              code: 200,
              message: '创建成功',
              data: {
                orderNo: 'ORD' + Date.now()
              }
            });
          }, 1000);
        });
      };
      
      paymentAPI.payOrder = function(token, orderNo, paymentType) {
        return new Promise((resolve) => {
          setTimeout(() => {
            resolve({
              code: 200,
              message: '支付成功',
              data: {
                orderNo: orderNo
              }
            });
          }, 1000);
        });
      };
      
      paymentAPI.activateVip = function(token) {
        return new Promise((resolve) => {
          setTimeout(() => {
            resolve({
              code: 200,
              message: 'VIP激活成功',
              data: null
            });
          }, 1000);
        });
      };
      
      // 模拟注册
      authAPI.register = function(phone, password, verifyCode, nickname) {
        return new Promise((resolve) => {
          setTimeout(() => {
            resolve({
              code: 200,
              message: '注册成功',
              data: {
                userId: 1,
                token: 'mock_token_123456'
              }
            });
          }, 1000);
        });
      };
    });
    
    // 关闭模态框
    function closeModal(modalId) {
      document.getElementById(modalId).style.display = 'none';
    }
  </script>
</body>
</html>
